package com.kurancy.domain.field.base;


	/**
	 * The Class NameValuePair.
	 *
	 * @author kduellman
	 */
	public class NameValuePair implements OptionPair {

		/** The Constant serialVersionUID. */
		private static final long serialVersionUID = 1433934089356546580L;
	
		/** The value. */
		public Object name, value;
		
		/**
		 * Instantiates a new name value pair.
		 */
		public NameValuePair() {}
		
		/**
		 * Instantiates a new name value pair.
		 *
		 * @param name the name
		 * @param value the value
		 */
		public NameValuePair(Object name, Object value) {
			
			this.name 	= name;
			this.value 	= value;
		}
	
		/**
		 * Gets the name.
		 *
		 * @return the name
		 */
		public Object getName() {
			return name;
		}
		
		/**
		 * Sets the name.
		 *
		 * @param name the name to set
		 */
		public void setName(Object name) {
			this.name = name;
		}
	
		/**
		 * Gets the value.
		 *
		 * @return the value
		 */
		public Object getValue() {
			return value;
		}
	
		/**
		 * Sets the value.
		 *
		 * @param value the value to set
		 */
		public void setValue(Object value) {
			this.value = value;
		}
		
		
	
		/* (non-Javadoc)
		 * @see java.lang.Object#toString()
		 */
		@Override
		public String toString() {
			
			//return "[name] " + this.getName() + " [value] " + this.getValue();
			
			return this.getValue() != null ? this.getValue().toString() : "";
		}
	
		/* (non-Javadoc)
		 * @see java.lang.Object#equals(java.lang.Object)
		 */
		@Override
		public boolean equals(Object obj) {
	
			if( !( obj instanceof NameValuePair ) )
			{
				return false;
			}
	
			NameValuePair nvp = (NameValuePair) obj;
	
			if( nvp.getName().equals(this.getName()) && nvp.getValue().equals(this.getValue()) )
			{
				return true;
			}
			
			return false;	
		}
		
	}